<template>
  <div v-if="show" class="all">
    <pre class="CodeStyleValue" :class="name">
    </pre>
  </div>
</template>

<script>
// 代码组件
import codeStyle from '@/api/CodeStyle'
import '@/style/CodeStyle.css'

export default {
  components: {},
  props: {
    code: {
      type: String,
      default: ""
    },
    name: {
      type: String,
      default: 'basics'
    }
  },
  data () {
    return {
      value: {},
      show: true
    }
  },
  watch: {},
  computed: {},
  methods: {},
  created () {},
  mounted () {
    if(this.code){
      let html = codeStyle(this.code)
      let css = '.CodeStyleValue.' + this.name
      document.querySelector(css).innerHTML = html
    }else{
      this.show = false
    }
  }
}
</script>
<style scoped>
</style>
